package org.gthelper.security;


import java.util.Map;

import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;


public interface IchkID
{
	public Map<String,Object> initKey()throws Exception;
	public byte[] getPublicKey(Map<String, Object> keyMap)throws Exception;
	public byte[] getPrivateKey(Map<String, Object> keyMap)throws Exception;
	public byte[] decryptByPrivateKey(byte[] data, byte[] key)throws Exception;
	public byte[] decryptByPublicKey(byte[] data, byte[] key)throws Exception;
	public boolean chkSign(byte[] data, byte[] sign, byte[] publicKey)throws Exception;
	public byte[] encryptSHA(byte[] data)throws Exception;
	
	public static byte[] decryptBASE64(String key)throws Exception {
		return (new BASE64Decoder()).decodeBuffer(key);
	}
	public static String encryptBASE64(byte[] key) throws Exception {  
	    return (new BASE64Encoder()).encodeBuffer(key);  
	}
	
}